import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
let path = require('path');
const port = 9999;
export default defineConfig({
  plugins: [vue()],
  base:'./',
  build:{
    outDir:'dist'
  },
  resolve: {
    alias: {
      '/@': path.resolve(__dirname, './src'),
      '/@components': path.resolve(__dirname, '/src/components'),
      '/@assets': path.resolve(__dirname, '/src/assets'),
      '/@router': path.resolve(__dirname, '/src/router'),
      '/@store': path.resolve(__dirname, '/src/store'),
      '/@api': path.resolve(__dirname, '/src/api'),
    }
  },
  server: {
    port,
    cors: true,
    proxy: {
      '/api': {
        target: '',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  }
})
